﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ForgetPassword : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    private void SendRetrievePassword()
    {
        BLLForgetPassword pass = new BLLForgetPassword();
        DALCustomer customer = new DALCustomer();
        string strUserID = tbEmail.Text.Trim();

        if(customer.isExist(tbEmail.Text.Trim()))
        {
            pass.sendEmail(tbEmail.Text.Trim());
        }
        else
        {
            Label2.Text = "Invalid Email";
        }
    }
    protected void btnPass_Click(object sender, EventArgs e)
    {
        try
        {

            btnPass.Enabled = false;

            SendRetrievePassword();

            Page.ClientScript.RegisterStartupScript(typeof(Page), "Javascript", "alert('Your Password has been send to your email address');", true);


        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "Javascript", "alert('" + ex.Message + "');", true);
            //btnPass.Text = "Retrieve Password";
            btnPass.Enabled = true;

        }
    }
}